<?php

namespace App\Listeners\Train\TrainOrder\Refund;

use App\Events\Train\TrainOrder\Refund\TicketReturnSuccessEvent;
use App\Models\Train\TrainOrderPassengers\Repositories\Interfaces\TrainOrderPassengersRepositoryInterface;

class TicketReturnSuccessListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param object $event
     *
     * @return void
     */
    public function handle(TicketReturnSuccessEvent $event)
    {
        // 乘客退票成功业务
        $orderPassengerRepo = app(TrainOrderPassengersRepositoryInterface::class);
        $orderPassengerRepo->ticketReturnSuccess($event->passenger, $event->refund_info);
    }
}
